/**
 * 访问控制服务
 */
import {Injectable} from "@angular/core";

@Injectable()
export class ACLService {
  private roles;
  private abilities;
  /** 数据类型 */
  public data: {
    roles: string[];
    abilities: number[];
  };

  public cusView = false;

  constructor() {
    //默认角色为游客
    this.data = {
      roles: ['T'],
      abilities: []
    };
  }

  setRoles(o: string[]) {
    this.data.roles = o;
    this.getData();
  }

  setAbilities(o: number[]) {
    this.data.abilities = o;
    this.getData();

  }

  clearAll() {
    this.setRoles([]);
    this.setAbilities([]);
    this.getData();

  }

  getData() {
    console.log(this.data);
  }

  setCusView(t:boolean){
    this.cusView = t;
    console.log(this.cusView);
  }

  getCusView():boolean{
    console.log(this.cusView);
    return this.cusView;
  }

}
